<?php

namespace api\controller;

// +----------------------------------------------------------------------
// | 媒体数据控制层
// +----------------------------------------------------------------------

use common\controller\VerifyController;
use common\service\MediaService;
use think\Request;

class MediaController extends VerifyController
{
    /**
     * @var \common\service\MediaService
     */
    protected $mediaService;


    public function __construct()
    {
        parent::__construct();
        $this->mediaService = new MediaService();
    }

    /**
     * 上传媒体
     * @param Request $request
     * @return \think\Response
     */
    public function upload(Request $request)
    {
        $mediaService = new MediaService();
        $resData = $mediaService->upload($request->param());
        return json(success_response('', $resData));
    }

    /**
     * 媒体单条查询
     * @return \think\Response
     */
    public function find(Request $request)
    {
        $res = $this->mediaService->find($request->param());
        return json(success_response("", $res));
    }
}